package com.object.comm;

import java.net.InetSocketAddress;

import org.apache.mina.core.service.IoConnector;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;

import com.object.handler.ClientHandler;
import com.object.model.UserInfo;

public class MyClient {
	public static void main(String[] args) {
		IoConnector connector = new NioSocketConnector();
		
		connector.setConnectTimeoutMillis(30000);
		connector.getFilterChain().addLast("logger", new LoggingFilter());
		connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
		
		connector.setHandler(new ClientHandler(new UserInfo("Mina")));
		
		connector.connect(new InetSocketAddress("127.0.0.1", 9876));
	}
}